WARNING: This program has a bug, which means we need to fix it!

RULE: We need to use the keyword global followed by the name of the variable that we would like to use inside of the event. We only need to use global for variables that were created earlier in the program, outside of the event.

  • Click Run and click on the pig. Read the error message.
  • Use a Global Variable in the event so that 1 is added to clicks and the click_count display updates each time you click on the pig.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)